﻿using Himp.Erp;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.DependencyInjection;

namespace Himp.Platform
{
    /// <summary>
    /// 库存管理
    /// </summary>
    public class InvManageQuery : ISingletonDependency
    {
        private readonly IServiceProvider _serviceProvider;

        public InvManageQuery(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        /// <summary>
        /// 入库单列表查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<InboundRecDto>> GetInboundRecListAsync(InboundRecInput input)
        {
            var inboundRecService = _serviceProvider.GetService<IInboundRecService>();

            return await inboundRecService.GetInboundRecListAsync(input);
        }

        /// <summary>
        /// 入库单明细查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<InboundRecDto> GetInboundRecAsync(Guid id)
        {
            var inboundRecService = _serviceProvider.GetService<IInboundRecService>();

            return await inboundRecService.GetInboundRecAsync(id);
        }

        /// <summary>
        /// 入库单明细查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<InboundDetlDto>> GetInboundDetlListAsync(InboundDetlInput input)
        {
            var inboundRecService = _serviceProvider.GetService<IInboundRecService>();

            return await inboundRecService.GetInboundDetlListAsync(input);
        }

        /// <summary>
        /// 库存变更类别
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<InvChgTypeDto>> GetInvChgTypeListAsync(InvChgTypeInput input)
        {
            var invChgTypeService = _serviceProvider.GetService<IInvChgTypeService>();

            return await invChgTypeService.GetListAsync(input);
        }

        /// <summary>
        /// 获取出入库列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<MatlInvDto>> GetInvRecListAsync(MatlInvInput input)
        {
            var matlInvService = _serviceProvider.GetService<IMatlInvService>();

            return await matlInvService.GetInvRecListAsync(input);
        }

        /// <summary>
        /// 获取库存明细列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<MatlInvDto>> GetInvDetlListAsync(MatlInvInput input)
        {
            var matlInvService = _serviceProvider.GetService<IMatlInvService>();

            return await matlInvService.GetInvDetlListAsync(input);
        }

        /// <summary>
        /// 获取库存汇总列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<MatlInvDto>> GetInvSumListAsync(MatlInvInput input)
        {
            var matlInvService = _serviceProvider.GetService<IMatlInvService>();

            return await matlInvService.GetInvSumListAsync(input);
        }

        /// <summary>
        /// 出库单列表查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<OutboundRecDto>> GetOutboundRecListAsync(OutboundRecInput input)
        {
            var outboundRecService = _serviceProvider.GetService<IOutboundRecService>();

            return await outboundRecService.GetOutboundRecListAsync(input);
        }

        /// <summary>
        /// 出库单明细查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<OutboundRecDto> GetOutboundRecAsync(Guid id)
        {
            var outboundRecService = _serviceProvider.GetService<IOutboundRecService>();

            return await outboundRecService.GetOutboundRecAsync(id);
        }

        /// <summary>
        /// 出库单明细查询
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedResultDto<OutboundDetlDto>> GetOutboundDetlListAsync(OutboundDetlInput input)
        {
            var outboundRecService = _serviceProvider.GetService<IOutboundRecService>();

            return await outboundRecService.GetOutboundDetlListAsync(input);
        }
    }
}
